import java.text.DateFormat;
import java.util.*;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;

import javax.imageio.ImageIO;
import javax.swing.ImageIcon;

public class Resources
{
    private Resources(){}
    public static Font getFont(FONT_TYPE id)
    {
        switch(id)
        {
            case DIALOG:
                return new Font(Font.DIALOG,Font.BOLD,14);
            case LABELS:
                return new Font(Font.SANS_SERIF,Font.PLAIN,14);
            case FIELDS:
                return new Font(Font.SANS_SERIF,Font.PLAIN,14);
            case TEXT_AREA:
                return new Font(Font.SANS_SERIF,Font.PLAIN,12);
            case TITLE:
                return new Font(Font.SANS_SERIF,Font.BOLD,24);
            case BORDER:
                return new Font(Font.SANS_SERIF,Font.BOLD,16);
            case TAB_LABEL:
                return new Font(Font.SANS_SERIF,Font.BOLD,12);
            case STATUS_BAR:
                return new Font(Font.MONOSPACED,Font.PLAIN,11);
            case CALENDAR_LABEL:
            	return new Font(Font.SANS_SERIF,Font.BOLD,11);
            case CALENDAR:
                return new Font(Font.SANS_SERIF,Font.BOLD,9);
            case SLIDER_ZOOM:
            	return new Font(Font.SANS_SERIF,Font.PLAIN,10);
            default:
                return new Font(Font.SANS_SERIF,Font.PLAIN,12);
        }
    }
    public static String getString(String string)
    {
        return stringBundle.getString(string);
    }
    public static ImageIcon getImage(String idImage)
    {
    	String imagePath  = "images/";
    	InputStream is = 
                Resources.class.getResourceAsStream(imagePath+idImage);
    	Image image;
    	try{
    		image = ImageIO.read(is);
    		return new ImageIcon(image);
    	}catch(IOException e)
    	{
    		return null;
    	}
    }
    public static Locale getLocale()
    {
    	return locale;
    }
    /*static{
        locale = new Locale("es","MX");
    	stringBundle = ResourceBundle.getBundle("lang.elite",locale);
    }*/
    public static enum FONT_TYPE
    {
        DIALOG,LABELS,FIELDS,TITLE,BORDER,TEXT_AREA,TAB_LABEL,STATUS_BAR,CALENDAR,CALENDAR_LABEL,SLIDER_ZOOM;
    }
    public static String getDateFormat(Date date)
    {
    	DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, locale);
    	return df.format(date);
    }
    public static DateFormat getDateFormat()
    {
    	return DateFormat.getDateInstance(DateFormat.SHORT, locale);
    }
    private static Locale locale = new Locale("es","MX");
    private static ResourceBundle stringBundle  = ResourceBundle.getBundle("lang.elite",locale);
}
